package com.mindainfo.groundwave.web.equipment.web;

import com.mindainfo.groundwave.common.api.equipment.param.TerminalQueryListParam;
import com.mindainfo.groundwave.common.api.equipment.service.ITerminalService;
import com.mindainfo.groundwave.common.api.equipment.vo.TerminalQueryListVo;
import com.mindainfo.groundwave.common.bean.CommonResult;
import com.mindainfo.groundwave.common.bean.TableData;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * Created by MD-01 on 2017/7/7.
 */
@Controller
@RequestMapping("/sys/terminal")
public class TerminalController {

    @Resource
    private ITerminalService terminalService;

    @RequestMapping("/page")
    public String page(){

        return "/equipment/terminal";
    }

    @RequestMapping("/queryList")
    @ResponseBody
    public TableData<TerminalQueryListVo> queryList(Integer start,Integer length,String draw,String key){

        TerminalQueryListParam param = new TerminalQueryListParam();
        param.setStart(start);
        param.setNum(length);
        param.setKey(key);
        CommonResult<TableData<TerminalQueryListVo>> result = terminalService.queryList(param);
        result.getData().setDraw(draw);
        return result.getData();
    }

}
